var e = require("../../services/api.js"),url = require("../../services/baseURL.js");

Component({
    properties: {
        position: {
            type: String,
            value: "index"
        }
    },
    data: {
        homeBanner: []
    },
    methods: {
        getLists: function() {
            var t = this;
            // (0, e.getBanners)({
            //     position: this.data.position
            // }).then(function(e) {
            //     200 === e.data.code && t.setData({
            //         homeBanner: e.data.data
            //     });
            // });
          wx.request({
            url: "".concat(url.baseURL, "/xcxapi/banner"),
            header: {
              'content-type': 'application/json' // 默认值
            },
            success(e) {
              if (200 === e.data.status) {
                t.setData(t.setData({
                  homeBanner: e.data.data
                }), wx.setStorageSync("store-type", e.data.data));
              }
          
            },
            fail(res) {
              console.log("请求错误！");
            }
          })
        },
        jump: function(e) {
            var t = e.currentTarget.dataset, n = t.type, a = t.url;
            1 == n && (-1 !== [ "/pages/index/index", "/pages/groupBuy/index", "/pages/share/index", "/pages/user/index" ].findIndex(function(e) {
                return e == a;
            }) ? wx.switchTab({
                url: a
            }) : wx.navigateTo({
                url: a
            }));
        }
    },
    attached: function() {
        this.getLists();
    }
});